package com.wjgl.action;

import com.opensymphony.xwork2.ActionSupport;
import com.wjgl.domain.Institution;
import com.wjgl.service.InstitutionService;

public class UpdateInstitutionAction extends ActionSupport {
	private InstitutionService institutionService;
	private Integer id;
	private String institutionName;
	private String institutionAddr;
	public InstitutionService getInstitutionService() {
		return institutionService;
	}
	public void setInstitutionService(InstitutionService institutionService) {
		this.institutionService = institutionService;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getInstitutionName() {
		return institutionName;
	}
	public void setInstitutionName(String institutionName) {
		this.institutionName = institutionName;
	}
	public String getInstitutionAddr() {
		return institutionAddr;
	}
	public void setInstitutionAddr(String institutionAddr) {
		this.institutionAddr = institutionAddr;
	}
	@Override
	public String execute() throws Exception {
		Institution ins = institutionService.findInstitutionById(id);
		ins.setName(institutionName);
		ins.setAddress(institutionAddr);
		institutionService.updateInstitution(ins);
		return SUCCESS;
	}
	
}
